Skip to content

Conversation

mattaschmann
Copy link
Contributor

@mattaschmann mattaschmann commented Jul 17, 2025

Will now return a 400 to the user with info on what the limit was that caused the error.

Overview

Currently, if a user inputs a limit that exceeds the value in the server.limits configuration variable and the value of on_exceed is error, a RunimeError will be returned. This is not ideal as it causes a 500 error to be returned to the user with no information on what caused it.

Suggested fix in this pr:

Change from a RuntimeError to a ValueError, as ValueError is already being handled to ensure that the limit is a positive number. This will also return a 400 to the user, notifying them of the limit so they can adjust their queries.

Related Issue / discussion

There is no existing issue for this. However, as it was a one line change, I consider it "trivial", and assume the discussion can happen here.

Dependency policy (RFC2)

  • I have ensured that this PR meets RFC2 requirements

Updates to public demo

Contributions and licensing

(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to pygeoapi. I confirm that my contributions to pygeoapi will be compatible with the pygeoapi license guidelines at the time of contribution
  • I have already previously agreed to the pygeoapi Contributions and Licensing Guidelines

Will now return a 400 to the user with info what the limit was that
caused the error.
@tomkralidis tomkralidis added this to the 0.21.0 milestone Jul 18, 2025
@tomkralidis tomkralidis self-requested a review July 20, 2025 11:04
@tomkralidis tomkralidis added bug Something isn't working OGC API - Features OGC API - Features OGC API - Records OGC API - Records labels Jul 20, 2025
@tomkralidis tomkralidis merged commit 11a7f46 into geopython:master Jul 20, 2025
3 checks passed
@mattaschmann mattaschmann deleted the handle-limit-exceed-gracefully branch September 16, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working OGC API - Features OGC API - Features OGC API - Records OGC API - Records

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants